package com.jintu.portal.pojo.dto;

import com.jintu.portal.pojo.bean.IsUsed;
import com.jintu.portal.pojo.entity.*;
import com.jintu.portal.utils.BeanUtils;

import java.io.Serializable;

/**
 * Created by junhu on 2017/9/22.
 */
public class TobUserDto implements Serializable {
    private Long companyId;//企业ID
    private String companyFullName;//企业全称
    private String companyShortName;//企业简称
    private Long userDepartmentId;//用户部门岗位Id
    private Long userId;//用户ID
    private String username;
    private String realname;
    private String phone;
    private String birthday;
    private String headimgUrl;//头像
    private String qq;//qq
    private String wx;//微信
    // ----- 部门信息 ----
    private Long departmentId;//部门ID
    private String fullName;//部门全称
    private String shortName;//部门简称
    private Long parentId;//上级部门ID
    private Long departmentTypeId;//部门类型ID
    private String parentName;//上级部门名称
    // ----- 岗位信息 ----
    private Long postId;//岗位Id
    private String postName;//岗位名称
    private Integer type;//岗位类型 1管理者，2员工
    private String token;//用户唯一登录标识

    private Integer isUsed;//是否可用1可用，0停用
    private String isUsedText;//是否可用1可用，0停用
    private Integer manyRole;//是否为多角色 1多角色，2单角色
    private String version;//版本号
    private Integer orderChannel;//订单渠道 1 Android，2 ios

    private Integer refundRight;  //退款权限,1为有权限

    //默认构造
    public TobUserDto(){}
    //参数构造
    public TobUserDto(TUserDepartmentPost userDepartmentPost, TDepartment department, TPost post, TUser user, TCompany tc) throws Exception {
        BeanUtils.copyProperties(userDepartmentPost, this);
        BeanUtils.copyProperties(department, this);
        BeanUtils.copyProperties(post, this);
        BeanUtils.copyProperties(user, this);
        this.setCompanyFullName(tc.getFullName());
        this.setCompanyShortName(tc.getShortName());
        this.setIsUsed(userDepartmentPost.getIsUsed());
        this.setUserDepartmentId(userDepartmentPost.getId());
        this.setDepartmentId(department.getId());
        this.setPostId(post.getId());
        this.setUserId(user.getId());
        this.postName = post.getName();
        this.phone = user.getUsername();
        this.refundRight = user.getRefundRight();
    }

    public TobUserDto(TUserDepartmentPost userDepartmentPost, TDepartment department, TPost post, TUser user) throws Exception {
        BeanUtils.copyProperties(userDepartmentPost, this);
        BeanUtils.copyProperties(department, this);
        BeanUtils.copyProperties(post, this);
        BeanUtils.copyProperties(user, this);
        this.setIsUsed(userDepartmentPost.getIsUsed());
        this.setUserDepartmentId(userDepartmentPost.getId());
        this.setDepartmentId(department.getId());
        this.setPostId(post.getId());
        this.setUserId(user.getId());
        this.postName = post.getName();
        this.phone = user.getUsername();
        this.refundRight = user.getRefundRight();
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getCompanyFullName() {
        return companyFullName;
    }

    public void setCompanyFullName(String companyFullName) {
        this.companyFullName = companyFullName;
    }

    public String getCompanyShortName() {
        return companyShortName;
    }

    public void setCompanyShortName(String companyShortName) {
        this.companyShortName = companyShortName;
    }

    public Long getUserDepartmentId() {
        return userDepartmentId;
    }

    public void setUserDepartmentId(Long userDepartmentId) {
        this.userDepartmentId = userDepartmentId;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getBirthday() {
        return birthday;
    }

    public void setBirthday(String birthday) {
        this.birthday = birthday;
    }

    public String getHeadimgUrl() {
        return headimgUrl;
    }

    public void setHeadimgUrl(String headimgUrl) {
        this.headimgUrl = headimgUrl;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getWx() {
        return wx;
    }

    public void setWx(String wx) {
        this.wx = wx;
    }

    public Long getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }

    public Long getDepartmentTypeId() {
        return departmentTypeId;
    }

    public void setDepartmentTypeId(Long departmentTypeId) {
        this.departmentTypeId = departmentTypeId;
    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getShortName() {
        return shortName;
    }

    public void setShortName(String shortName) {
        this.shortName = shortName;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getParentName() {
        return parentName;
    }

    public void setParentName(String parentName) {
        this.parentName = parentName;
    }

    public Long getPostId() {
        return postId;
    }

    public void setPostId(Long postId) {
        this.postId = postId;
    }

    public String getPostName() {
        return postName;
    }

    public void setPostName(String postName) {
        this.postName = postName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getIsUsed() {
        return isUsed;
    }

    public void setIsUsed(Integer isUsed) {
        this.isUsed = isUsed;
    }

    public String getIsUsedText() {
        if(this.isUsed.equals(IsUsed.USED.getValue())) {
            return "启用";
        }else {
            return "已停用";
        }
    }

    public void setIsUsedText(String isUsedText) {
        this.isUsedText = isUsedText;
    }

    public Integer getManyRole() {
        return manyRole;
    }

    public void setManyRole(Integer manyRole) {
        this.manyRole = manyRole;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public Integer getOrderChannel() {
        return orderChannel;
    }

    public void setOrderChannel(Integer orderChannel) {
        this.orderChannel = orderChannel;
    }

    public Integer getRefundRight() {
        return refundRight;
    }

    public void setRefundRight(Integer refundRight) {
        this.refundRight = refundRight;
    }
}
